package com.yyx.up.common.util;

import java.text.DecimalFormat;

/**
 * Description: 数字工具类
 * @Author: yyx
 * @Create: 2023/4/10 16:45
 * @Version: 8
 */
public class NumberUtil {
    /**
     * 将数字格式化为字符串
     * @param num
     * @param length
     * @return
     */
    public static String format(int num,int length){
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 1; i <= length; i++){
            stringBuilder.append("0");
        }
        DecimalFormat df = new DecimalFormat(stringBuilder.toString());
        return df.format(num);
    }

    /*public static void main(String[] args) {
        System.out.println(format(10,10));
    }*/
}
